<?php
/**
 * Created by PhpStorm.
 * User: yangjiaming
 * Date: 2018/2/8
 * Time: 14:30
 */

namespace Eagle\Service;


use Eagle\Adapter\Front\GoodsAdapter;
use Halo\Data\DAO;

class Backend extends Base
{
    public function goodsList($params, $page = [])
    {
        $goodsDao = new DAO(new GoodsAdapter());
        $result = $goodsDao->read($params, ['id', 'sort', 'name', 'img', 'status', 'create_time'], $page);
        if(!empty($result['data'])) {
            foreach ($result['data'] as &$value) {
                $value['state'] = $value['status'] == '上架' ? '下架':'上架';
                $value['date'] = date('Y-m-d H:i:s', $value['create_time']);
            }
        }
        return $result;
        /*return [
            'statistic'=>['count'=>1],
            'data'=>[
                ['id'=>1,'sort'=> 1,'title'=>'s','type'=> 'xiu','status'=>'上架','date'=> '1'],
                ['id'=>1,'sort'=> 1,'title'=>'s','type'=> 'xiu','status'=>'下架','date'=> '1'],
            ]
        ];*/
    }
}